﻿using Expect.Core.Interfaces;
using WatiN.Core;

namespace Expect.WatiN
{    
    /// <summary>
    /// Extension methods to facilitate WatiN usage
    /// </summary>
    public static class WatiNExtensions
    {
        /// <summary>
        /// Get the browser associated with execution context
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static Browser Browser(this IExecutionContext context)
        {
            return (Browser)context.Data["Browser"];
        }

        /// <summary>
        /// Set the browser associated with execution context
        /// </summary>
        /// <param name="context"></param>
        /// <param name="browser"></param>
        public static void SetBrowser(this IExecutionContext context, Browser browser)
        {
            context.Data["Browser"] = browser;
        }
    }
}
